package com.gopay.common.constants.cbrmb;

/**
 * 
 * @ClassName: CbRmbOrderState
 * @Description: cbrmb 银行付款订单状态
 * @author gd.cui
 * @date 2016年7月21日 上午11:09:01 ww.gopay.com.cn Inc.All rights reserved.
 */
public enum CbRmbOrderState {
    /** 初始化 */
    INIT("00"),
    /** 代报盘(支付成功) */
    OFFER_READY("01"),
    /** 报盘进行中 */
    OFFER_ONGOING("02"),
    /** 报盘成功 */
    OFFER_SUCCESS("04"),
    /** 报盘失败 */
    OFFER_FAIL("05"),
    /** 付款成功 */
    PAY_SUCCESS("06"),
    /** 付款失败 */
    PAY_FAIL("07");
    public final String value;

    private CbRmbOrderState(String value) {
        this.value = value;
    }

    public String getValue() {
        return this.value;
    }

    public static String codeTranslate(String value) {
        switch (value) {
        case "00":
            return "初始化";
        case "01":
            return "待报盘";
        case "02":
            return "报盘中";
        case "04":
            return "报盘成功";
        case "05":
            return "报盘失败";
        case "06":
            return "付款成功";
        case "07":
            return "付款失败";

        default:
            break;
        }
        return null;
    }
    
    public static CbRmbOrderState getStateByStr(String value) {
        CbRmbOrderState[] values = CbRmbOrderState.values();
        for (CbRmbOrderState state : values) {
            if (state.value.equals(value)) {
                return state;
            }
        }
        return null;
    }
}
